 <?php

class JsonToArray{

    private $source;

    public function __construct($source){
        $this->source = $source;
        $this->transform();
    }


    public function transform(){


        $ch = curl_init();

        // set URL and other appropriate options
        curl_setopt($ch, CURLOPT_URL, $this->source);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

        // grab URL and pass it to the browser
        $data = curl_exec($ch);

        // close cURL resource, and free up system resources
        curl_close($ch);

        //var_dump(json_decode($data, true));


        $dataJson = '[';

        $dataArr = json_decode($data, true);
        $dataValues = $dataArr['values'];
        //var_dump($dataValues);
        for ($i = 0; $i < count($dataValues); $i++) {
            if ($i != 0) {
                $dataJson .= ',';
            }
            $dataJson .= '[' . $dataValues[$i]['x'] . '000,' . $dataValues[$i]['y'] . ']';
        }

        $dataJson .= ']';

        return $dataJson;

    }

}

?>